package web.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import web.pojo.User;

public interface UserMapper {

    public Integer count();

    public User userInfo(@Param("id") Long id);

    @Select("select id from user where username = #{un} and password = md5(#{pwd})")
    public Long findIdByUsernameAndPassword(@Param("un") String username, @Param("pwd") String password);

    @Select("select count(1) from user where id = #{id}")
    public boolean existsById(@Param("id") Long id);

    @Select("update user set username = #{username} where id = #{id}")
    public void modifyUserNameById(@Param("username") String username, @Param("id") Long id);

    @Select("update user set password = md5(#{password}) where id = #{id}")
    public void modifyUserPasswordById(@Param("password") String password, @Param("id") Long id);
}
